/*=============================================================================
    test/test-html.js
    Copyright (C) 2008-2009, Donald W. Griffin
    All rights reserved.
    [MIT license :: see license.txt for details]
=============================================================================*/

gTests.push
(
    // escapeHtml
    function ()
    {
        var s = jibits.escapeHtml("<hello>");
        assertEquals("&lt;hello&gt;", s);
    },

    // unescapeHtml
    function ()
    {
        var s = jibits.unescapeHtml("&lt;hello&gt;");
        assertEquals("<hello>", s);
    },

    // extractScripts
    function ()
    {
        var s = jibits.extractScripts("Hello<script>foo<a>hello</a></script>"+
                                      "<a x=\"2\"/>World");
        assertEquals(1, s.length);
        assertEquals("foo<a>hello</a>", s[0]);
    },
    function ()
    {
        var s = jibits.extractScripts("<html>Hello<script>foo<a>hello</a></script>"+
                                      "<script>x=42;</script>World</html>");
        assertEquals(2, s.length);
        assertEquals("foo<a>hello</a>", s[0]);
        assertEquals("x=42;", s[1]);
    },

    // scrubScripts
    function ()
    {
        var s = jibits.scrubScripts("Hello<script>foo</script>World");
        assertEquals("HelloWorld", s);
    },
    function ()
    {
        var s = jibits.scrubScripts("Hello<script>foo<a>hello</a></script>"+
                                    "<a x=\"2\"/>World");
        assertEquals("Hello<a x=\"2\"/>World", s);
    },

    // scrubTags
    function ()
    {
        var s = jibits.scrubTags("Hello<script>foo<a>hello</a></script>"+
                                 "<a x=\"2\"/>World");
        assertEquals("HellofoohelloWorld", s);
    }
);
